<template>
    <div class="loginHeader">
        <div class="close" @click="onClickLeft">
            <svg t="1670170644203" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="29616" width="48" height="48"><path d="M511.232 438.8352L112.9984 40.6016A51.2 51.2 0 0 0 40.6016 112.9984L438.784 511.232 40.6016 909.4656a51.2 51.2 0 1 0 72.3968 72.448l398.2336-398.2848 398.2336 398.2848a51.2 51.2 0 1 0 72.448-72.448l-398.2848-398.2336 398.2848-398.2336A51.2 51.2 0 0 0 909.4656 40.6016L511.232 438.784z" p-id="29617" fill="#8a8a8a"></path></svg>
        </div>
        <div class="otherLogin" @click="loginChange">{{$route.name=='loginByPhone'?'密码登录':$route.name=='loginByPsw'?'手机号登录':''}}</div>
    </div>
</template>

<script>
import { useRoute, useRouter } from 'vue-router';
export default {
    name:'loginHeader',
    setup(props,context) {
        const route = useRoute();
        const router = useRouter();
        const onClickLeft = () => history.back();
        const loginChange = () => {
            console.log(route.name);
            if(route.name == 'loginByPhone') router.replace('/loginPlus/loginByPsw');
            else if(route.name == 'loginByPsw') router.replace('/loginPlus/loginByPhone');
        }
        return {
            onClickLeft,
            loginChange
        };
    },
    props:['others']
}
</script>

<style>
.loginHeader{
    box-sizing: border-box;
    padding: 40px 25px 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.loginHeader .close{
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
}
.loginHeader .close svg{
    width: 20px;
    height: 20px;
}
.otherLogin{
    font-size: 18px;
    font-weight: 500;
}
</style>